package cn.cena.pay.domain;

import cn.cena.basic.domain.BaseDomain;
import com.alipay.easysdk.kernel.Config;
import lombok.Data;

@Data
public class PayAlipayIninfo extends BaseDomain {
    // 平台id
    private String shop_id;
    // 平台名称
    private String shopName;
    private String appid;
    private String merchant_private_key;
    private String alipay_public_key;
    private String protocol;
    private String gatewayHost;
    private String signType;
    // 异步回调地址
    private String notifyUrl;
    // 同步回调地址
    private String returnUrl;

    /**
     * 配置支付宝配置信息
     * @return
     */
    public Config getOptions() {
        Config config = new Config();
        config.protocol = this.protocol;
        config.gatewayHost = this.gatewayHost;
        config.signType = this.signType;
        config.appId = this.appid;
        // 为避免私钥随源码泄露，推荐从文件中读取私钥字符串而不是写入源码中
        config.merchantPrivateKey = this.merchant_private_key;
         config.alipayPublicKey = this.alipay_public_key;
        //可设置异步通知接收服务地址（可选）
        config.notifyUrl = this.notifyUrl;
        return config;
    }
}
